package com.cd.university.common.obs;

import com.obs.services.ObsClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * obs的相关配置类
 * 返回一个ObsClient
 * @author 陈栋
 * @create 2021/10/13 13:51
 */
@Configuration
public class ObsConfig {
    @Value("${huawei.obs.ak}")
    private String access_Key_Id;


    @Value("${huawei.obs.sk}")
    private String secret_Access_Key;

    @Value("${huawei.obs.upload.endPoint}")
    private String endPoint;



    /**
     * 获得Obs的对象，用于上传文件等等
     * @return 返回Obs的Client对象
     */
    @Bean(name = "obsClient")
    public ObsClient getObsClient() {
        ObsClient obsClient = new ObsClient(access_Key_Id,
                secret_Access_Key,
                endPoint);

        return obsClient;
    }
}
